@import '../var';

$navbar-z: 10530;
$navbar-fixed-z: 10530;
$navbar-dropdown-z: 10520;

$navbar-colors: $colors;
$navbar-divider-height: 1px;

.navbar {
  @each $name, $pair in $navbar-colors {
    $color: nth($pair, 1);
    $color-invert: nth($pair, 2);
    &.is-#{$name} {
      background-color: $color;
      color: $color-invert;
      a.navbar-item,
      .navbar-link {
        background-color: transparent;
        color: $color-invert;
        &::after {
          border-color: $color-invert;
        }
      }
      .navbar-divider {
        background-color: darken($color-invert, 10%);
      }
      .navbar-item.has-dropdown {
        .navbar-dropdown {
          background-color: $color;
          color: $color-invert;
          border-left: 1px solid lighten($color, 10%);
        }
        &.is-hoverable:hover,
        &.is-hoverable.is-active {
          a.navbar-item,
          .navbar-link {
            background-color: transparent;
            &:hover,
            &.is-active {
              // background-color: $primary;
              // background-color: darken($color, 5%);
              color: lighten($color-invert, 10%);
            }
          }
        }
      }
    }
  }
  a.navbar-item,
  .navbar-link {
    i {
      margin-right: 5px;
    }
  }
  .navbar-divider {
    margin: 0;
  }
  .navbar-item.has-dropdown {
    padding: 0;
  }
  .navbar-dropdown {
    font-size: 1rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    border-top: transparent;
    border-radius: 4px;
    margin-top: 1px;
    min-width: 10em;
    a.navbar-item,
    .navbar-link {
      padding: 0.5rem 1rem;
      line-height: 1;
    }
    .navbar-link {
      width: 100%;
      padding-right: 2.5rem;

      &::after {
        transform: rotate(-135deg);
      }
    }
    .navbar-item.has-dropdown {
      & > .navbar-dropdown {
        display: none;
        margin-top: -0.25rem;
        // margin-left: 1px;
        top: 0;
        left: 100%;
      }
      &.is-hoverable:hover,
      &.is-hoverable:focus,
      &.is-active {
        & > .navbar-dropdown {
          display: block;
        }
      }
    }
  }
}
